import { Controller, Post, Body, Ip, Request } from '@nestjs/common';
import { UserActionService } from './user-action.service';
import { CreateUserActionDto } from './dto/create-user-action.dto';

@Controller('user-action')
export class UserActionController {
  constructor(private readonly userActionService: UserActionService) {}

  @Post()
  create(
    @Body() createUserActionDto: CreateUserActionDto,
    @Ip() ip: string,
    @Request() req: AuthRequest,
  ) {
    return this.userActionService.create({
      ...createUserActionDto,
      ip,
      userId: req.user.userId,
    });
  }
}
